package tech.yunjing.log.remote;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cloud.client.discovery.DiscoveryClient;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import tech.yunjing.base.core.common.BaseResult;
import tech.yunjing.base.core.common.Constants;
import tech.yunjing.base.core.dao.redis.RedisTemplateUtil;
import tech.yunjing.log.service.ApplicationLogService;

import java.util.List;

/**
 * Created by L on 2017/4/24.
 */
@RestController
@RequestMapping("/V0.0.1")
public class ServiceLogController {

    @Autowired
    private ApplicationLogService applicationLogService;




    @RequestMapping(value = "/findAllByName",method = RequestMethod.POST)
    public BaseResult findAll(@RequestParam("name") String name,@RequestParam("pageNo")String pageNo,@RequestParam("pageSize")String pageSize){
        if (pageNo==null||pageSize==null){
            return new BaseResult(Constants.RESPONSE_CODE_400, Constants.RESPONSE_MESSAGE_400);
        }
        int pno = Integer.parseInt(pageNo);
        int psize = Integer.parseInt(pageSize);
        return applicationLogService.findByNameByPage(name,pno,psize);
    }

    @RequestMapping(value = "/findAllService",method = RequestMethod.GET)
    public BaseResult findAllService(){
        return applicationLogService.findAllService();
    }


}
